package routers

import (
	"CMETO/controllers/deptController"
	middleware "CMETO/middlewares"

	"github.com/gin-gonic/gin"
)

func DeptApi(r *gin.RouterGroup) {
	var dept deptController.DeptController
	deptRouter := r.Group("/dept", middleware.JWTAuthPlus())
	{
		deptRouter.GET("/", dept.QueryDepts)
		deptRouter.GET("/all", dept.QueryDeptAll)
		deptRouter.GET("/all/tree", dept.QueryDeptTrees)
		deptRouter.GET("/:id", dept.QueryDeptById)
		deptRouter.POST("/", dept.AddDept)
		deptRouter.PUT("/", dept.UpdateDept)
		deptRouter.DELETE("/", dept.DeleteDept)
		deptRouter.GET("/subset/:id", dept.QueryDeptSubset)
		deptRouter.GET("/tree", dept.QueryDeptTree)
		deptRouter.GET("/upper/:id", dept.QueryDeptUpper)
	}
}
